Object-oriented programming builds computer programs using objects, which are often instances of classes. Classes are defined using types, and in many implementations classes can inherit data and/or instructions from other classes. Objects have data fields, which are variously referred to as attributes, properties, or fields. Objects also have routines, which are variously referred to as functions, operators, procedures, or methods. Objects may model or represent things found in the real world.
Instead of organizing programs primarily as instructions and data, an object-oriented approach integrates instructions and data into objects which generally have both state (data) and behavior (instructions). As a result, object-oriented programming can facilitate software maintenance and upgrades by supporting encapsulation and information hiding. Defining software as modular components (objects) that support inheritance facilitates re-using components that already exist and extending components by defining new subclasses with specialized behaviors. An object-oriented approach encourages a developer to place data where it is not directly accessible by the rest of the system. Instead, data is accessed by calling object methods, which are tied to the data. An object's methods act as intermediaries for reading or writing the data they control.